#!/bin/bash
set -x
set -e
# Spawn the Rails App.
echo "* SPAWNING RAILS:"
bundle exec rails s -p 3000 -b '0.0.0.0' &

# Wait for it to come up, and then ensure the database is created and migrated.
sleep 5
echo "* MIGRATING DATABASE (if needed):"
bundle exec rails db:migrate

echo "* RUNNING..."
wait
